// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1

Item {
    id: notification_bar
    width: 480
    height: notification_show_item.height

    /////////////////////////////////////////           signal close this
    signal closeMe()

    /////////////////////////////////////////           property s
    property int showtime: 5000
    property string notification_string: ""

    /////////////////////////////////////////           function set showtime and start to show
    function start_notification(time, str)
    {
        notification_string = str;
        showtime = time;
        show_timer.running = true;
    }

    /////////////////////////////////////////           show time of this panel
    Timer
    {
        id: show_timer
        interval: showtime; running: false; repeat: false; triggeredOnStart : false;

        onTriggered:
        {
            hidepanel.running = true;
        }
    }

    /////////////////////////////////////////           hide this panel
    Timer
    {
        id: hidepanel
        interval: 200; running: false; repeat: false; triggeredOnStart : false;

        onTriggered:
        {
            closeMe();
        }
    }

    /////////////////////////////////////////           background
    Rectangle
    {
        id: notification_show_item
        width:parent.width
        height: notification_text.paintedHeight + 20
        color: "black"
//        radius: 10
        opacity: 0.9
    }

    /////////////////////////////////////////           show text
    Text {
        id: notification_text
        width: parent.width - 20
        anchors.top: notification_show_item.top
        anchors.topMargin: 5
        color: "white"
        wrapMode: Text.WrapAtWordBoundaryOrAnywhere
        text: notification_string
        smooth: true
        font.pixelSize: 33

        anchors.centerIn: parent
    }

    /////////////////////////////////////////           Behavior s
    Behavior on opacity {
        PropertyAnimation { duration: 200; easing.type: Easing.OutQuad }
    }

    Behavior on scale {
        PropertyAnimation { duration: 200; easing.type: Easing.OutQuad }
    }

    /////////////////////  state hide
    states: [
        State {
            name: "hide"
            PropertyChanges {
                target: notification_bar
//                x:0
                scale: 0
                opacity: 0
            }
        }
    ]
}
